<?php
session_start();
$goodsname = $_GET["goodsname"];
$price = $_GET['price'];
$goods = $_SESSION["goods"];

if($goods[$goodsname]['number']>1)
{ 	 

 $_SESSION['totalprice'] = $_SESSION['totalprice']-$price* $goods[$goodsname]['number'];
 unset($goods[$goodsname]);
}
else //如果数量为1，移除
{
 unset($goods[$goodsname]);	
 //unset($_SESSION['totalprice']);
// unset($_SESSION['totalprice']);
 $_SESSION['totalprice']= $_SESSION['totalprice']-$price ;
}

$_SESSION["goods"] = $goods; //最后存一下购物车的内容

header("location:gwc.php");